//2009/07/26 16:22:22
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class PeopleCircle
{
public:
    string order(int numMales, int numFemales, int K)
    {
		string person(numMales + numFemales, 'M');
		int index = person.size() -1;
		int length = numMales;
		while(numFemales)
		{
			for(int i=0; i<K)
			{
				index = (index + 1) %person.size();
				if(person.at(index) == 'M')
					i++;
			}
			person.at(index) = 'F';
		}
		return person;
    }
};
//Nice method to do the replace things.
//It's easier to understand and write the code.
//The algorithm is from Topcoder's editorials.
